ActionController::Routing::Routes.draw do |map|

  map.resource_image 'resources/:id/:width.:height.jpg', :controller => 'images', :action => 'image'
  map.resource_image_width 'resources/:id/:fit_width.:width.:height.jpg', :controller => 'images', :action => 'image'

  map.resources :comments, :as => "avis", :only => [:index]
  map.resources :tags, :only => [:index, :show]

  map.resources :images, :as => "galerie", :only => [:show, :index] do |image|
    image.resources :comments, :only => [:index]
    image.resources :tags, :only => [:index, :show]
  end
  
  map.resources :posts, :as => "blog" , :only => [:show, :index]  do |post|
    post.resources :comments, :only => [:index]
    post.resources :tags, :only => [:index, :show]
  end

  map.namespace :admin do |admin|
    admin.resources :comments, :only => [:destroy]
    admin.resources :tags, :only => [:destroy]
    admin.resources :images, :only => [:destroy] do |image|
      image.resources :comments, :only => [:destroy]
      image.resources :tags, :only => [:destroy]
    end

    admin.resources :posts, :only => [:destroy]  do |post|
      post.resources :comments, :only => [:destroy]
      post.resources :tags, :only => [:destroy]
    end
  end

  map.contact 'contact', :controller => "home", :action => "contact"


  map.root :controller => "home"

  #map.connect ':controller/:action/:id'
  #map.connect ':controller/:action/:id.:format'

end
